import storage from '@/lib/utils/storage'
import { defLang, STORE_KEY_LANG } from '@/config/constants'

export const SET_LANG = 'SET_LANG'

export default {
  state: {
    lang: storage.get(STORE_KEY_LANG) || defLang
  },

  mutations: {
    [SET_LANG]: (state, lang) => {
      storage.set(STORE_KEY_LANG, lang)
      state.lang = lang
    }
  }
}
